/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.net.greenet.policybank.logic;

import cn.net.greenet.common.policy_service.PolicySupport;
import com.ambimmort.prserver.bean.RepositoryOperationLogBean;
import net.sf.json.JSONObject;

/**
 * 根据指定的MessageType和MessageNo来获取该策略的最新版本和内容
 * @author liangdelin
 */
public class GetMessageContent {
    
    public String getMessage(String type, String instance, int messageNo)
    {
        //getMessage(String type, String instance, int messageNo)
            RepositoryOperationLogBean logBean= PolicySupport.getInstance().getApi().getMessage(type, instance, messageNo);
            JSONObject jo=new JSONObject();
            jo.put("id", logBean.getId());
            jo.put("CreateTime",logBean.getCreateTime() );
            jo.put("MessageNo", logBean.getSvnFile().getMessageNo());
            jo.put("Content", logBean.getSvnFile().getContent());  //这里需要解析UC
            
            return jo.toString();
        
    }
}
